<!DOCTYPE HTML>
<html>
<head>
    <title>Pixi Trim</title>
    <script src="../src/pixi/Pixi.js"></script>
    <script src="../src/pixi/core/Point.js"></script>
    <script src="../src/pixi/core/Rectangle.js"></script>
    <script src="../src/pixi/core/Polygon.js"></script>
    <script src="../src/pixi/core/Circle.js"></script>
    <script src="../src/pixi/core/Ellipse.js"></script>
    <script src="../src/pixi/core/Matrix.js"></script>
    <script src="../src/pixi/display/DisplayObject.js"></script>
    <script src="../src/pixi/display/DisplayObjectContainer.js"></script>
    <script src="../src/pixi/display/Sprite.js"></script>
    <script src="../src/pixi/display/SpriteBatch.js"></script>
    <script src="../src/pixi/display/MovieClip.js"></script>
    <script src="../src/pixi/filters/FilterBlock.js"></script>
    <script src="../src/pixi/text/Text.js"></script>
    <script src="../src/pixi/text/BitmapText.js"></script>
    <script src="../src/pixi/InteractionData.js"></script>
    <script src="../src/pixi/InteractionManager.js"></script>
    <script src="../src/pixi/display/Stage.js"></script>
    <script src="../src/pixi/utils/Utils.js"></script>
    <script src="../src/pixi/utils/EventTarget.js"></script>
    <script src="../src/pixi/utils/Detector.js"></script>
    <script src="../src/pixi/utils/Polyk.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
    <script src="../src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
    <script src="../src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
    <script src="../src/pixi/renderers/webgl/shaders/StripShader.js"></script>
    <script src="../src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
    <script src="../src/pixi/renderers/webgl/shaders/ComplexPrimitiveShader.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
    <script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLStencilManager.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
    <script src="../src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
    <script src="../src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
    <script src="../src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
    <script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
    <script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
    <script src="../src/pixi/primitives/Graphics.js"></script>
    <script src="../src/pixi/extras/Strip.js"></script>
    <script src="../src/pixi/extras/Rope.js"></script>
    <script src="../src/pixi/extras/TilingSprite.js"></script>
    <script src="../src/pixi/extras/Spine.js"></script>
    <script src="../src/pixi/textures/BaseTexture.js"></script>
    <script src="../src/pixi/textures/Texture.js"></script>
    <script src="../src/pixi/textures/RenderTexture.js"></script>
    <script src="../src/pixi/loaders/AssetLoader.js"></script>
    <script src="../src/pixi/loaders/JsonLoader.js"></script>
    <script src="../src/pixi/loaders/AtlasLoader.js"></script>
    <script src="../src/pixi/loaders/SpriteSheetLoader.js"></script>
    <script src="../src/pixi/loaders/ImageLoader.js"></script>
    <script src="../src/pixi/loaders/BitmapFontLoader.js"></script>
    <script src="../src/pixi/loaders/SpineLoader.js"></script>
    <script src="../src/pixi/filters/AbstractFilter.js"></script>
    <script src="../src/pixi/filters/AlphaMaskFilter.js"></script>
    <script src="../src/pixi/filters/ColorMatrixFilter.js"></script>
    <script src="../src/pixi/filters/GrayFilter.js"></script>
    <script src="../src/pixi/filters/DisplacementFilter.js"></script>
    <script src="../src/pixi/filters/PixelateFilter.js"></script>
    <script src="../src/pixi/filters/BlurXFilter.js"></script>
    <script src="../src/pixi/filters/BlurYFilter.js"></script>
    <script src="../src/pixi/filters/BlurFilter.js"></script>
    <script src="../src/pixi/filters/InvertFilter.js"></script>
    <script src="../src/pixi/filters/SepiaFilter.js"></script>
    <script src="../src/pixi/filters/TwistFilter.js"></script>
    <script src="../src/pixi/filters/ColorStepFilter.js"></script>
    <script src="../src/pixi/filters/DotScreenFilter.js"></script>
    <script src="../src/pixi/filters/CrossHatchFilter.js"></script>
    <script src="../src/pixi/filters/RGBSplitFilter.js"></script>
</head>
<body>

    <script>

    // loader = new PIXI.AssetLoader([ "atlas_json_hash_trim.json"]);
    loader = new PIXI.AssetLoader([ "SpriteSheet.json", "SpriteSheetTrimmed.json"]);
    loader.onComplete = onAssetsLoaded
    loader.load();

    var stage = new PIXI.Stage(0x666699);
    // var renderer = PIXI.autoDetectRenderer(400, 300);
    var renderer = new PIXI.CanvasRenderer(800, 600);
    document.body.appendChild(renderer.view);

    var sprite;
    var trimmedSprite;

    var graphics;

    function onAssetsLoaded()
    {
        // explosionTextures.push(PIXI.Texture.fromFrame("Explosion_Sequence_A " + (i+1) + ".png"));
        // trimmedExplosionTextures.push(PIXI.Texture.fromFrame("TExplosion_Sequence_A " + (i+1) + ".png"));

        var texture = PIXI.Texture.fromFrame("Explosion_Sequence_A 10.png");
        sprite = new PIXI.Sprite(texture);
        // sprite.anchor.set(0.5, 0.5);
        sprite.position.set(0, 0);

        var texture2 = PIXI.Texture.fromFrame("TExplosion_Sequence_A 10.png");
        trimmedSprite = new PIXI.Sprite(texture2);
        // trimmedSprite.anchor.set(0.5, 0.5);
        trimmedSprite.position.set(0, sprite.height + 2);

        console.log(trimmedSprite.texture.frame.width, '=', trimmedSprite.texture.renderWidth);
        console.log(trimmedSprite.texture.frame.height, '=', trimmedSprite.texture.renderHeight);

        stage.addChild(sprite);
        stage.addChild(trimmedSprite);

        graphics = new PIXI.Graphics();
        stage.addChild(graphics);

        requestAnimFrame(animate);
    }

    function animate()
    {
        // sprite.rotation += 0.01;

        graphics.clear();
        graphics.lineStyle(1, 0x0000FF, 1);
        graphics.drawRect(sprite.x, sprite.y, sprite.width, sprite.height);

        graphics.lineStyle(1, 0xFF00FF, 1);
        graphics.drawRect(trimmedSprite.x, trimmedSprite.y, trimmedSprite.width, trimmedSprite.height);

        renderer.render(stage);
        requestAnimFrame(animate);
    }

    </script>

    <p><a href="index.html">Test 1</a></p>
    <p><a href="index2.html">Test 2</a></p>
    <p><a href="index3.html">Test 3</a></p>

    </body>
</html>
